package com.songshuai.sales.client.feign;

import com.songshuai.sales.client.config.MultipartSupportConfig;
import com.songshuai.webapi.baseapi.dto.feign.request.pangu.salemeeting.QueryCustomersReqDto;
import com.songshuai.webapi.baseapi.dto.feign.request.pangu.salemeeting.SendInvitationReqDto;
import com.songshuai.webapi.baseapi.dto.feign.request.pangu.salemeeting.TalkNotesReqDto;
import com.songshuai.webapi.baseapi.dto.feign.response.DictionaryDto;
import com.songshuai.webapi.baseapi.dto.feign.response.pangu.salemeeting.*;
import com.songshuai.webapi.baseapi.dto.pangu.request.salesclient.CustomerListReqDto;
import com.songshuai.webapi.baseapi.dto.pangu.request.service.AddInviteServiceItemReqDto;
import com.songshuai.webapi.baseapi.dto.pangu.request.service.ServiceReqDto;
import com.songshuai.webapi.baseapi.dto.pangu.response.salesclient.CustomerInfoDto;
import com.songshuai.webapi.baseapi.dto.pangu.response.service.InviteServiceItemTreeResDto;
import com.songshuai.webapi.baseapi.model.sales.SalesInfo;
import com.songshuai.webapi.baseapi.pojo.BaseParmDto;
import com.songshuai.webapi.baseapi.pojo.QueryPageRes;
import com.songshuai.webapi.baseapi.pojo.QueryResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@FeignClient(name = "pangu-api" ,configuration = MultipartSupportConfig.class,fallback =PanguApiClientFallback.class )
public interface PanguApiClient {

    @GetMapping(value = "/api/pangu/queryUserById")
    SalesInfo queryUserById(@RequestParam("id") String id);

    /**
     *
     *销售获取客户列表
     */
    @PostMapping(value = "/api/pangu/salesClient/getCustomerList")
    QueryResponse<List<CustomerInfoDto>> getCustomerList(@RequestBody BaseParmDto<CustomerListReqDto> request);


    /**
     * 查询会议列表
     * @param type 0-最近 1-未来
     * @param userId 当前登陆用户id
     * @return
     */
    @GetMapping("/api/salemeeting/queryMeetingList")
    QueryResponse<List<MeetingListResDto>> queryMeetingList(@RequestParam(value = "type",required = false,defaultValue = "0")Integer type,
                                                            @RequestParam("userId")String userId);

    /**
     * 根据会议查询客户集合
     * @param userId 当前登陆人
     * @param code 会议编号
     * @return
     */
    @GetMapping("/api/salemeeting/queryCustomerList")
    QueryResponse<List<CustomerListResDto>> queryCustomerList(@RequestParam("userId")String userId,
                                                              @RequestParam("code")String code);

    /**
     * 查看邀请函
     * @param code 会议编号
     * @return
     */
    @GetMapping("/api/salemeeting/queryInvitationLetter")
    QueryResponse<List<InvitationLetterResDto>> queryInvitationLetter(@RequestParam("code")String code);


    /**
     * 查询客户信息
     * 邀约客户，根据姓名或手机号模糊查询
     * @return
     */
    @PostMapping("/api/salemeeting/queryCustomers")
    QueryResponse<QueryPageRes<List<CustomerInfosResDto>>> queryCustomers(@RequestBody BaseParmDto<QueryCustomersReqDto> request);


    /**
     * 发送邀请函
     * @return
     */
    @PostMapping("/api/salemeeting/sendInvitation")
    QueryResponse sendInvitation(@RequestBody SendInvitationReqDto request);



    /**
     * 查看客户回执单信息
     * @param inviteNo 邀约编号
     * @return
     */
    @GetMapping("/api/salemeeting/queryReceipt")
    QueryResponse<ReceiptInfoResDto> queryReceipt(@RequestParam("inviteNo")String inviteNo);


    /**
     * 查询销售人员信息
     * @param userId
     * @return
     */
    @GetMapping("/api/salemeeting/querySalesInfo")
    QueryResponse<List<SalesManInfoResDto>> querySalesInfo(@RequestParam("userId")String userId);


    /**
     * 转交客户
     * @param userId 当前用户id
     * @param cluesIds 客户id集合
     * @param saleIds 转交销售id集合
     * @return
     */
    @PostMapping("/api/salemeeting/handOverCustomer")
    QueryResponse<Boolean> handOverCustomer(@RequestParam("userId")String userId,
                                   @RequestParam("cluesIds")List<Long> cluesIds,
                                   @RequestParam("saleId")List<Integer> saleIds);



    /**
     * 新增沟通记录
     * @return
     */
    @PostMapping("/api/salemeeting/addTalkNotes")
    QueryResponse<Boolean> talkNotes(@RequestBody TalkNotesReqDto request);



    /**
     * 根据字典类型查询字典
     * @param type
     * @return
     */
    @GetMapping("/api/common/queryDictionariesByType")
    QueryResponse<List<DictionaryDto>> queryDictionariesByType(@RequestParam("type")Integer type);



    /**
     * 根据id查询字典详情
     * @param id
     * @return
     */
    @GetMapping("/api/common/queryDictionaryDetail")
    QueryResponse<DictionaryDto> queryDictionaryDetail(@RequestParam("id")Integer id);


    /**
     * 上传图片 （七牛云）
     * @param file
     * @param imgMaxSize
     * @param basePath
     * @param imgPath
     * @return
     */
    @PostMapping(value ="/api/common/uploadPicture",consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    QueryResponse uploadPicture(@RequestPart("file") MultipartFile file, @RequestParam("imgMaxSize") Integer imgMaxSize,
                                @RequestParam("basePath")String basePath, @RequestParam("imgPath")String imgPath);


    /**
     * 图片上传（阿里云）
     * @param file
     * @return
     */
    @PostMapping(value ="/api/common/uploadPictureOss",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    QueryResponse uploadPictureOss(@RequestPart("file") MultipartFile file);



    /**
     * 查询服务标准化列表
     * @return
     */
    @GetMapping("/api/service/getAllServiceList")
    QueryResponse<List<InviteServiceItemTreeResDto>> getAllServiceList();



    /**
     * 获取邀约服务已反馈信息
     * @param reqDto
     * @return
     */
    @PostMapping("/api/service/getInviteServiceItems")
    QueryResponse<List<String>> getInviteServiceItems(@RequestBody ServiceReqDto reqDto);



    /**
     * 新增邀约服务反馈信息
     * @param reqDto
     * @return
     */
    @PostMapping("/api/service/addInviteServiceItem")
    QueryResponse<Boolean> addInviteServiceItem(@RequestBody AddInviteServiceItemReqDto reqDto);


    /**
     * 获取客户历史沟通记录
     * @param clueGuid
     * @return
     */
    @GetMapping("/api/salemeeting/getCommunicateList")
    QueryResponse<List<CommunicateListResDto>> getCommunicateList(@RequestParam("clueGuid")Long clueGuid);


}
